<?php

/**
 * This is the model class for table "Price_History".
 *
 * The followings are the available columns in table 'Price_History':
 * @property integer $Index
 * @property string $Date
 * @property string $ProductNum
 * @property string $Div
 * @property string $SubDiv
 * @property string $ProductName
 * @property string $ProductDetail
 * @property string $Reason
 * @property double $Pricing
 * @property string $MXCode
 * @property string $Remark
 * @property string $Login
 * @property string $Modifier
 * @property string $CreateTime
 * @property string $UpdateTime
 * @property string $Platform
 */
class PriceHistory extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return PriceHistory the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'Price_History';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('Pricing', 'numerical'),
			array('Date, ProductNum, Div, SubDiv, MXCode', 'length', 'max'=>20),
			array('ProductName, ProductDetail', 'length', 'max'=>100),
			array('Reason, Remark', 'length', 'max'=>1073741823),
			array('Login, Modifier, Platform', 'length', 'max'=>50),
			array('CreateTime, UpdateTime', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('Index, Date, ProductNum, Div, SubDiv, ProductName, ProductDetail, Reason, Pricing, MXCode, Remark, Login, Modifier, CreateTime, UpdateTime, Platform', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'Index' => 'Index',
			'Date' => 'Date',
			'ProductNum' => 'Product Num',
			'Div' => 'Div',
			'SubDiv' => 'Sub Div',
			'ProductName' => 'Product Name',
			'ProductDetail' => 'Product Detail',
			'Reason' => 'Reason',
			'Pricing' => 'Pricing',
			'MXCode' => 'Mxcode',
			'Remark' => 'Remark',
			'Login' => 'Login',
			'Modifier' => 'Modifier',
			'CreateTime' => 'Create Time',
			'UpdateTime' => 'Update Time',
			'Platform' => 'Platform',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('Index',$this->Index);
		$criteria->compare('Date',$this->Date,true);
		$criteria->compare('ProductNum',$this->ProductNum,true);
		$criteria->compare('Div',$this->Div,true);
		$criteria->compare('SubDiv',$this->SubDiv,true);
		$criteria->compare('ProductName',$this->ProductName,true);
		$criteria->compare('ProductDetail',$this->ProductDetail,true);
		$criteria->compare('Reason',$this->Reason,true);
		$criteria->compare('Pricing',$this->Pricing);
		$criteria->compare('MXCode',$this->MXCode,true);
		$criteria->compare('Remark',$this->Remark,true);
		$criteria->compare('Login',$this->Login,true);
		$criteria->compare('Modifier',$this->Modifier,true);
		$criteria->compare('CreateTime',$this->CreateTime,true);
		$criteria->compare('UpdateTime',$this->UpdateTime,true);
		$criteria->compare('Platform',$this->Platform,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}